from config.crypto_config import CODE_GEN_PROMPT_TEMPLATES, SYSTEM_MESSAGE_TEMPLATES
from langchain_core.messages import SystemMessage, HumanMessage

def generatorCryptoEvalCode(llm, key_data, gen_type, crypto_eval_extract, api_info, gen_language):
    system_message = SystemMessage(content=SYSTEM_MESSAGE_TEMPLATES)
    if gen_type == "AUTH":
        return CODE_GEN_PROMPT_TEMPLATES[f"{gen_type}_CODE_GENERATOR"]
    else:
        prompt_message = CODE_GEN_PROMPT_TEMPLATES[f"{gen_type}_CODE_GENERATOR"].format(
            key_information=crypto_eval_extract[key_data],
            crypto_eval_information=crypto_eval_extract[gen_type],
            api_information=api_info,
            language=gen_language
        )
        query_messages = [
            system_message,
            HumanMessage(content=prompt_message)
        ]
        return llm(query_messages).content